<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>medicalchart</title>
    <link rel="stylesheet" href="https://www.layuicdn.com/layui-v2.6.8/css/layui.css">
</head>
<body>

<form  method="get" id="searchMedicalchart">
    <p>查找的id<input type="text" name="mnum" class="layui-input" style="width: 150px;border-color: black"/></p>
    <input type="button" id="search" value="查找" class="layui-btn layui-btn-primary"/>
</form>

<div id="sr" hidden>
<label>病例号:</label><span id="smnum"></span><br>
<label>学号:</label><span id="ssno"></span><br>
<label>诊断医生名字:</label><span id="sdname"></span><br>
<label>时间:</label><span id="smdate"></span><br>
<label>诊断信息:</label><span id="sdiagnosis"></span><br>
</div>




<form method="get" id="deleteMedicalchart">
    <p>删除的id<input type="text" name="mnum" class="layui-input" style="width: 150px;border-color: black"/></p>
    <input type="button" id="delete" value="删除" class="layui-btn layui-btn-primary"/>
</form>



<div id="dr" hidden>
    <label>message:</label><span id="dmessage"></span><br>
</div>




<form  method="get" id="addMedicalchart">
    <p>学号:<input type="text" name="sno"  class="layui-input" style="width: 150px;border-color: black"/></p>
    <p>诊断医生名字:<input type="text" name="dname"  class="layui-input" style="width: 150px;border-color: black"/></p>
    <p>时间:<input type="text" name="mdate"  class="layui-input" style="width: 150px;border-color: black"/></p>
    <p>诊断信息:<input type="text" name="diagnosis"  class="layui-input" style="width: 150px;border-color: black"/></p>
    <input type="button" id="add" value="添加" class="layui-btn layui-btn-primary"/>
</form>



<div id="ar" hidden>
    <label>病例号:</label><span id="amnum"></span><br>
    <label>学号:</label><span id="asno"></span><br>
    <label>诊断医生名字:</label><span id="adname"></span><br>
    <label>时间:</label><span id="amdate"></span><br>
    <label>诊断信息:</label><span id="adiagnosis"></span><br>
</div>



<form  method="get" id="updateMedicalchart">
    <p>病例号:<input type="text" name="mnum" class="layui-input" style="width: 150px;border-color: black"/></p>
    <p>学号:<input type="text" name="sno" class="layui-input" style="width: 150px;border-color: black"/></p>
    <p>诊断医生名字:<input type="text" name="dname" class="layui-input" style="width: 150px;border-color: black"/></p>
    <p>时间:<input type="text" name="mdate" class="layui-input" style="width: 150px;border-color: black"/></p>
    <p>诊断信息:<input type="text" name="diagnosis" class="layui-input" style="width: 150px;border-color: black"/></p>
    <input type="button" id="update" value="更新" class="layui-btn layui-btn-primary"/>
</form>





<div id="ur" hidden>
    <label>病例号:</label><span id="umnum"></span><br>
    <label>学号:</label><span id="usno"></span><br>
    <label>诊断医生名字:</label><span id="udname"></span><br>
    <label>时间:</label><span id="umdate"></span><br>
    <label>诊断信息:</label><span id="udiagnosis"></span><br>
</div>




<script src="https://www.layuicdn.com/layui/layui.js"></script>
<script>
    layui.use(['layer', 'jquery'], function(){
        var layer = layui.layer //获得 layer 模块
            ,$ = layui.jquery //获得 jquery 模块


    $("#search").click(function () {
        $.get("[[@{medicalchart/selectOne}]]", $("#searchMedicalchart").serialize(),
            function(data){
                $("#smnum").text(data.mnum);
                $("#ssno").text(data.sno);
                $("#sdname").text(data.dname);
                $("#smdate").text(data.mdate);
                $("#sdiagnosis").text(data.diagnosis);
                layer.open({
                    type: 1,
                    content: $('#sr')
                });

            });
    })




    $("#delete").click(function () {
        $.get("[[@{medicalchart/deleteOne}]]", $("#deleteMedicalchart").serialize(),
            function(data){
                $("#dmessage").text(data);
                layer.open({
                    type: 1,
                    content: $('#dr')
              });
            });
    })





    $("#add").click(function () {
        $.get("[[@{medicalchart/addOne}]]", $("#addMedicalchart").serialize(),
            function(data){
                $("#amnum").text(data.mnum);
                $("#asno").text(data.sno);
                $("#adname").text(data.dname);
                $("#amdate").text(data.mdate);
                $("#adiagnosis").text(data.diagnosis);
                layer.open({
                    type: 1,
                    content: $('#ar')
                });
            });
    })


    $("#update").click(function () {
        $.get("[[@{medicalchart/updateOne}]]", $("#updateMedicalchart").serialize(),
            function(data){
                $("#umnum").text(data.mnum);
                $("#usno").text(data.sno);
                $("#udname").text(data.dname);
                $("#umdate").text(data.mdate);
                $("#udiagnosis").text(data.diagnosis);
                layer.open({
                    type: 1,
                    content: $('#ur')
                });
            });
    })
    })

</script>

</body>
</html>